package com.small.site.service.impl;

import com.small.site.base.ITestService;
import com.small.site.ibase.impl.BaseServiceImpl;
import com.small.site.pojo.Test;
import org.apache.dubbo.config.annotation.DubboService;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

/**
 * @author xiaochi
 * @date 2021/11/21 15:24
 * @desc TestServiceImpl
 *  注意在使用 dubbo 时，如果需要事务，则需要在 @Service上加上 interfaceClass 属性，指定接口类型，
 *  如果不指定，这个接口被多个代理，不知道找那个接口，导致服务发布不成功
 */
@DubboService(interfaceClass = ITestService.class)
public class TestServiceImpl extends BaseServiceImpl<Test> implements ITestService {

    @Override
    public List<Test> findAndWhere(Test test) {
        Example example = new Example(Test.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.orEqualTo(Test.Fields.id,1)
                .orEqualTo(Test.Fields.id,2);
        return this.findByWhere(example);
    }
}